#!/usr/bin/env bash

# main.sh

# This file is part of Leah (Language editor and helper).

# Leah is part of Faridayix, an artificially intelligent computer
# operating system.

# Copyright (C) 2010 Scott C. MacCallum
# scottmaccal@gmail.com

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

bold_font="\e[1m"
default_font="\e[0m"
reverse_font="\e[7m"

clear

echo -e -n $default_font

printf "Hello $USER, Leah speaking."
printf "\n"
printf "\n"
printf "How can I help you? ${bold_font}"

read help

if [[ "$help" == "what version are you" || "$help" == "version" ]]; then
  clear

  printf "${default_font}This part of me has not been developed yet."

  sleep 5

  leah
fi

if [[ "$help" == "i need help" || "$help" == "help" ]]; then
  clear

  printf "${bold_font}HELP${default_font}"
  printf "\n"
  printf "\n"
  printf "I understand the following statements, questions, or keywords:"
  printf "\n"
  printf "\n"
  printf "${bold_font}i need ${reverse_font}help${default_font}"
  printf "\n"
  printf "\n"
  printf "${bold_font}what ${reverse_font}version${default_font} ${bold_font}are you${default_font}"
  printf "\n"
  printf "\n"
  printf "${bold_font}${reverse_font}edit${default_font} ${bold_font}file${default_font}"

  sleep 10

  leah
fi

if [[ "$help" == "edit file" || "$help" == "edit" ]]; then
  edit_file

  elif [[ "$edit_file" == "no" || "$edit_file"  == "n" ]]; then
    printf "\n"
    printf "Would you like to create a new file? ${bold_font}"

    read new_file

    echo -e -n $default_font
fi

if [[ "$new_file" == "yes" || "$new_file" == "y" ]]; then
  create_new_file

  elif [[ "$new_file" == "no" || "$new_file" == "n" ]]; then
    printf "\n"
    printf "Would you like to end our conversation? ${bold_font}"

    read end_conversation

    echo -e -n $default_font
fi

if [[ "$end_conversation" == "yes" || "$end_conversation" == "y" ]]; then
  exit 0

  elif [[ "$end_conversation" == "no" || "$end_conversation" == "n" ]]; then
    leah
fi

else
  yes_or_no

  sleep 5

  leah
fi
#EOF
